package com.training.java.core.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class LaptopMutableDemo {

	public static void main(String[] args) {

		LaptopMutable laptop1 = new LaptopMutable();

		laptop1.setCompany("hp");
		laptop1.setModel("a200");
		laptop1.setOperatingSystem("windows7");

		LaptopMutable laptop2 = new LaptopMutable();

		laptop2.setCompany("sony");
		laptop2.setModel("b2000");
		laptop2.setOperatingSystem("windows8");

		LaptopMutable laptop3 = new LaptopMutable();

		laptop3.setCompany("Accer");
		laptop3.setModel("ac333");
		laptop3.setOperatingSystem("windows xp");

		List laptops = new ArrayList();

		laptops.add(laptop1);
		laptops.add(laptop2);
		laptops.add(laptop3);

		// Read from list

		Iterator laptopsIterator = laptops.iterator();
		while (laptopsIterator.hasNext()) {

			LaptopMutable aLaptopMutable = (LaptopMutable) laptopsIterator
					.next();

			System.out.println("Start printing LaptopMutable details *******");

			System.out.println("Company = " + aLaptopMutable.getCompany());
			System.out.println("Model = " + aLaptopMutable.getModel());
			System.out.println("Operating System = "
					+ aLaptopMutable.getOperatingSystem());

			System.out.println("End printing LaptopMutable details *******");

		}

	}

}
